package com.zqxq.lottery.cms.controller;

import com.zqxq.common.constant.Result;
import com.zqxq.lottery.cms.feign.LotteryServerFeignClient;
import com.zqxq.lottery.entity.bo.order.UserOrderBO;
import com.zqxq.lottery.entity.vo.order.UserOrderVO;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(value = "订单管理",tags = "订单管理")
@RestController
@Slf4j
@RequestMapping(value = "/order", produces = "application/json")
public class OrderController {

    @Autowired
    private LotteryServerFeignClient lotteryServerFeignClient;

    @ApiOperation(value = "用户订单-查询", notes="用户订单-查询")
    @PostMapping("/userorder/page")
    public Result queryUserOrderPage(UserOrderBO search){
        return lotteryServerFeignClient.queryUserOrderPage(search);
    }

    @ApiOperation(value = "用户订单-详情", notes="用户订单-详情")
    @PostMapping("/userorder/get")
    public Result getUserOrder(Long id){
        log.info("传入参数 id={}",id);
        return lotteryServerFeignClient.getUserOrder(id);
    }

    @ApiOperation(value = "用户订单-保存", notes="用户订单-保存")
    @PostMapping("/userorder/save")
    public Result saveUserOrder(UserOrderVO vo){
        return lotteryServerFeignClient.saveUserOrder(vo);
    }

    @ApiOperation(value = "用户订单出票-保存", notes="用户订单出票-保存")
    @PostMapping("/orderticket/save")
    public Result saveOrderTickets(String orderId, String ticketUrls){
        return lotteryServerFeignClient.saveOrderTickets(orderId,ticketUrls);
    }

  /*  @ApiOperation(value = "订单-中奖计算", notes="订单-中奖计算")
    @PostMapping("/lottery/calc")
    public Result orderLotteryCalc(Long lotteryId){
        return lotteryServerFeignClient.orderLotteryCalc(lotteryId);
    }*/

    @ApiOperation(value = "订单-出票", notes="订单-出票")
    @PostMapping("/userorder/buyTicket")
    public Result buyTicket(Long orderId){
        return lotteryServerFeignClient.buyTicket(orderId);
    }

}
